<%@ page pageEncoding='UTF-8'%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<s:set var="contextPath" value="#request.get('javax.servlet.forward.context_path')" scope="request" />
<!DOCTYPE html>
<head>
    <title>Drug Issue Details</title>
    <%-- header --%>
    <jsp:include page="/WEB-INF/content/common/Header.jsp" flush="true"/>
</head>
<body class="metro">
	<%-- tob-bar --%>
    <jsp:include page="/WEB-INF/content/common/TopBar.jsp" flush="true"/>
       	
	<div id="main-container" class="body-wrapper">
        <%-- tob-container --%>
    	<jsp:include page="/WEB-INF/content/common/TopContainer.jsp" flush="true"/>
        
    	<div id="body-container">
        	<div id="prescription-registration-form-container" class="form-container">
        		<s:set var="mode" value="'details'"/>
   				<jsp:include page="/WEB-INF/content/drugIssue/DrugIssueMenuContainer.jsp" flush="true"/>
   				
               	<fieldset>
               		<div class="patient-info-container user-info-container">
               			<legend>Patient Summery</legend>
               			<a href="${contextPath}/patient/show?id=${guiPrescription.patient.userId}">
	               			<div class="tile full-width ${guiPrescription.patient.male ? 'bg-lightBlue' : 'bg-lightPink'}">
								<div class="user-profile-image place-left">
									<s:if test="%{guiPrescription.patient.male}">
										<img class="list-icon bg-lightBlue" src="${contextPath}/img/icon/Man-128.png"/>
									</s:if>
									<s:elseif test="%{guiPrescription.patient.female}">
		          						<img class="list-icon bg-lightPink" src="${contextPath}/img/icon/Woman-128.png"/>
		         					</s:elseif>
		                		</div>
	               				<div class="user-profile-info-container">
		                			<div class="user-profile-info">
		                				<div class="subheader">${guiPrescription.patient.name}</div>
		                				<p class="subheader-secondary">${guiPrescription.termString}</p>
		                			</div>
	               				</div>
	               			</div>
               			</a>
               		</div>
                   	
                   	<div class="medicine-info-container">
	                   	<p class="subheader-secondary">Medicine</p>
	                   	<table class="table striped bordered hovered">
	                   		<thead class="medicine-header-container">
	                   			<tr>
	                   				<th>Drug</th>
	                   				<th>Terms Per Day</th>
	                   				<th>No. Of Days</th>
	                   				<th>Get Treatment</th>
	                   				<th>Issue</th>
	                   			</tr>
	                   		</thead>
	                   		<tbody id="prescription-drug-issue-container">
	                   			<s:iterator var="oDrugIssue" value="%{guiPrescription.drugIssueList}" status="stat">
		                   			<tr class="drug-issue-container">
		                   				<td>${oDrugIssue.drug.name}</td>
		                   				<td>${oDrugIssue.termsPerDay}</td>
		                   				<td>${oDrugIssue.noOfDays}</td>
		                   				<td>${oDrugIssue.treatmentTime.label}</td>
		                   				<td>
                                        	<input type="hidden" name="guiPrescription.drugIssueList[${stat.count}].drugIssueId" value="${oDrugIssue.drugIssueId}"/>
                                            <input type="hidden" name="guiPrescription.drugIssueList[${stat.count}].drug.drugId" value="${oDrugIssue.drug.drugId}"/>
                                            <input type="hidden" name="guiPrescription.drugIssueList[${stat.count}].termsPerDay" value="${oDrugIssue.termsPerDay}"/>
                                            <input type="hidden" name="guiPrescription.drugIssueList[${stat.count}].noOfDays" value="${oDrugIssue.noOfDays}"/>
                                            <input type="hidden" name="guiPrescription.drugIssueList[${stat.count}].treatmentTime" value="${oDrugIssue.treatmentTime.id}"/>
											<label class="input-control checkbox">
                                                <s:if test="%{#oDrugIssue.issue}">
                                                    <input type="checkbox" name="guiPrescription.drugIssueList[${stat.count}].issue" value="true" checked="checked" disabled="disabled"/>
                                                </s:if>
                                                <s:else>
                                                    <input type="checkbox" name="guiPrescription.drugIssueList[${stat.count}].issue" value="true" disabled="disabled"/>
                                                </s:else>
                                                <span class="check"></span>
                                            </label>
										</td>
		                   			</tr>
	                   			</s:iterator>
	                   		</tbody>
	                   	</table>
                   	</div>
                   	<br/>
                   	<div class="treatment-date-container">
	                   	<legend>Treatment Date</legend>
	                   	<div class="subheader-secondary">${guiPrescription.dateString}</div>
                   	</div>
                   	<br/>
                     <div class="form-button-container">
						<a href="${contextPath}/drugissue/edit?prescriptionId=${guiPrescription.prescriptionId}">
		                  	<div class="form-button tile half-vertical subheader-secondary bg-cobalt fg-white">
		                    Edit <i class="icon-pencil on-right smaller"></i>
		                  	</div>
						</a>
						<a href="${contextPath}">
	                    	<div class="form-button tile half-vertical subheader-secondary bg-cyan fg-white">
	                      	cancel <i class="icon-cancel-2 on-right smaller"></i>
	                     	</div>
						</a>
	                    <br clear="all"/>
	                 </div> 
       			</fieldset>
    		</div>    
    	</div>
        
        <%-- bottom-container --%>
    	<jsp:include page="/WEB-INF/content/common/BottomContainer.jsp" flush="true"/>
        
	</div>
    
    <%-- footer-container --%>
    <jsp:include page="/WEB-INF/content/common/FooterContainer.jsp" flush="true"/>
    
</body>
</html>